#ifndef __SERIAL_H_
#define __SERIAL_H_

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>  
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>
#include <pthread.h>
#include <stdbool.h>
#include <termios.h> 


typedef enum {
	FrameHead = (0XC0),
	FrameType,
	FrameLength,
	FrameData,
	FrameCheck
}Read_Enum;

typedef enum {
    DataFrame = (0XCB),//数据帧
    RespondFrame = (0XCF),//回应帧
}FrameType_e;

#define UART3_FRAME_HEAD 0XAA
#define UART3_FRAME_TYPE_DATA 0XCB
#define UART3_FRAME_TYPE_RESPOND 0XCF
#define UART3_FRAME_LENGTH 0X05
#define UART3_FRAME_DATA_MAX_SIZE 0X10

typedef struct{
    uint8_t FrameHeader;//帧头
    FrameType_e FrameType;//帧类型
    uint8_t FrameLength;//帧长度
    uint8_t FrameDataAdress[UART3_FRAME_DATA_MAX_SIZE];//帧数据
    uint8_t FrameCheck;//帧校验和

    bool IsSuccessRecieve;//是否成功接收一帧数据
}H6_Read_Data;

typedef struct{
    uint8_t FrameHeader;//帧头
    FrameType_e FrameType;//帧类型
    uint8_t FrameLength;//帧长度
    uint8_t FrameDataAdress[UART3_FRAME_DATA_MAX_SIZE];//帧数据
    uint8_t FrameCheck;//帧校验和

    bool IsSuccessSend;//是否成功接收一帧数据
}H6_Write_Data;

typedef struct{
	int fd;
    H6_Read_Data read_data;
}s_read_arg;

typedef struct {
	int fd;
	H6_Write_Data write_data;	
}s_write_arg;




#endif //__SERIAL_H_



